function getUploadToken(data, view) {
    // return view.$store.dispatch('proxyAction', {
    //     name: 'getUploadToken',
    //     data
    // });

    return G_transmit('getUploadToken', {
         data
    })
}

function getFileKey(path, signature, fileName) {
    const suffix = getFileSuffix(fileName);

    let prefix = signature.replace(/[\'\"\\\/\b\f\n\r\t]/g, '').replace(/[/[\@\#\$\%\^\&\*\(\)\{\}\:\"\L\<\>\?\[\]\+\-\=]/g, '');
    prefix = `${path + new Date().getTime().toString() + prefix.substr(prefix.length - 10, 10)}`;

    return `${prefix}.${suffix}`;
}

function getFileSuffix(fileName) {
    const start = fileName.lastIndexOf('.');
    const { length } = fileName;
    const suffix = fileName.substring(start + 1, length);
    return suffix.toLowerCase();
}

export default {
    getUploadToken,
    getFileKey,
    getFileSuffix
};
